package com.yc.model;

import com.yc.bean.Resfood;
import lombok.Data;

import java.io.Serializable;

/**
 * @author zwei
 * @create 2024-06-13 14:39
 */

public class CartItem implements Serializable {
    private Resfood food;
    private Integer num;
    private double smallCount;

    public void setFood(Resfood food) {
        this.food = food;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public void setSmallCount(double smallCount) {
        this.smallCount = smallCount;
    }

    public Resfood getFood() {
        return food;
    }

    public Integer getNum() {
        return num;
    }

    public double getSmallCount() {
        //对商品的小计计算
        if (food!=null){
            smallCount=this.food.getRealprice()*this.num;
        }
        return smallCount;
    }
}
